package com.starhub.monitor.dto;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 系统资源监控DTO
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SystemResourcesDto {
    
    /**
     * CPU使用率
     */
    private double cpuUsage;
    
    /**
     * 内存使用率
     */
    private double memoryUsage;
    
    /**
     * 已使用存储空间(GB)
     */
    private double usedStorage;
    
    /**
     * 总存储空间(GB)
     */
    private double totalStorage;
    
    /**
     * 系统运行时间(秒)
     */
    private long uptimeSeconds;

    /**
     * 获取格式化的运行时间 (X天Y小时Z分钟S秒)
     */
    public String getFormattedUptime() {
        long days = uptimeSeconds / (24 * 60 * 60);
        long hours = (uptimeSeconds % (24 * 60 * 60)) / (60 * 60);
        long minutes = (uptimeSeconds % (60 * 60)) / 60;
        long seconds = uptimeSeconds % 60;

        return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒";
    }
}